<!-- 维修页面 -->
<template>
	<view class="">
		<dispatch titleName="维修任务" compoType="wx" :treeData='copyData'  @searchChange="searchChange" @determine="determine"></dispatch>
	</view>
</template>


<script>
	import dispatch from '../common/dispatch.vue'
	import searchCom from "@/components/searchCom.vue"
	import mixins from '@/utils/mixins.js'
	import {
		lineSectionRepairList,//树形列表
	} from '@/api/engineeringMaintenance/maintenanceTask.js'
	export default {
		name:'repair',
		mixins:[mixins],
		components: {
			searchCom,
			dispatch
		},
		data() {
			return {
				TreeData:[],
				copyData:[],
				keyword:undefined,
				allNums:0
			}
		},
		onShow() {
			this.getMaintenanceTask()
		},
		methods: {
			// 获取维修树形数据
			getMaintenanceTask() {
				lineSectionRepairList({
					projectId: uni.getStorageSync('isOwner'),
					projectStates: ["zj","zt"],
					code:'gcwb',
					type:'repair'
				}).then(res => {
					console.log(res, '树形结构')
					if (res.status === 1 && res.success) {
						this.TreeData = res.result
						this.copyData = res.result
						// this.copyData = this.filterData(res.result)
					}
				})
			},
			/**
			 * 输入框值变化的时候
			 * @param {String} val
			 */
			searchChange(val) {
				// this.keyword = val
				if(!val) {
					this.copyData = this.TreeData
				}
			},
			determine(ev) {
				console.log(ev)
				if(!ev) {
					this.copyData = this.TreeData
				}else{
					this.copyData = this.mapTree(ev, this.TreeData)
				}
				
			},
		}
	}
</script>
<style scoped lang="scss">
	.pos {
		z-index: 10
	}
	.pos-num {
		    position: relative;
		    text-align: center;
		    line-height: 25px;
		    top: -85px;
		    z-index: 15;
		    color: #fbfbfb;
		    width: 25px;
		    height: 25px;
		    border-radius: 20px;
		    background: red;
		    left: 233px;
	}
</style>